<template>
  <div>
    <div class="PocketAI-search-tabs">
      <h3 style="width: 100%;text-align: start;margin: 20px 0;padding: 0 20px;">Storage AI</h3>
      <div :class="`tabs-item ${tabActive === 'knowledge' ? 'tabActive' : ''}`" @click="tabsActive('knowledge')">
        <img v-show="!(tabActive === 'knowledge')" src="@/assets/image/message1.svg" alt="" />
        <img v-show="tabActive === 'knowledge'" src="@/assets/image/message2.svg" alt="" />
        <span>个人知识库</span>
      </div>
      <div :class="`tabs-item ${tabActive === 'FileSAearch' ? 'tabActive' : ''}`" @click="tabsActive('FileSAearch')">
        <img v-show="!(tabActive === 'FileSAearch')" src="@/assets/image/search1.svg" alt="" />
        <img v-show="tabActive === 'FileSAearch'" src="@/assets/image/search2.svg" alt="" />
        <span>AI文件搜索</span>
      </div>
      <div :class="`tabs-item ${tabActive === 'PPT' ? 'tabActive' : ''}`" @click="tabsActive('PPT')">
        <img v-show="!(tabActive === 'PPT')" src="@/assets/image/image1.svg" alt="" />
        <img v-show="tabActive === 'PPT'" src="@/assets/image/image2.svg" alt="" />
        <span>出差报告</span>
      </div>
      <div :class="`tabs-item ${tabActive === 'Blog' ? 'tabActive' : ''}`" @click="tabsActive('Blog')">
        <img v-show="!(tabActive === 'Blog')" src="@/assets/image/book1.svg" alt="" />
        <img v-show="tabActive === 'Blog'" src="@/assets/image/book2.svg" alt="" />
        <span>博客生成</span>
      </div>
    </div>
    <RouterView />
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { RouterView, useRouter } from 'vue-router'
const router = useRouter()
const tabActive = ref('knowledge')

const tabsActive = (data) => {
  tabActive.value = data
  router.push(`/PocketAI/${data}`)

}
onMounted(() => {
  tabActive.value = router.currentRoute.value.name
})
</script>

<style lang="scss" scoped>
.PocketAI-search-tabs {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 188px;
  padding: 0 16px;
  height: 100%;
  border-right: 1px solid #e1e1e1;

  .tabs-item {
    position: relative;
    width: 156px;
    height: 48px;
    display: flex;
    transition: all 0.3s;
    align-items: center;
    justify-content: start;
    padding-left: 12px;
    border-radius: 33px;
    margin-bottom: 10px;

    img {
      width: 16px;
      height: 16px;
    }

    span {
      margin-left: 10px;
      font-size: 14px;
    }
  }

  .tabActive {
    border-radius: 6px;
    background: #DEE5FE;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      right: 10px;
      transform: translate(0, -50%);
      /* 三角形的宽度 */
      width: 0;
      height: 0;
      border-top: 5px solid transparent;
      /* 三角形的高度 */
      border-bottom: 5px solid transparent;
      /* 三角形的高度 */
      border-left: 5px solid var(--el-color-primary);
      /* 三角形的颜色和宽度 */
    }

    span {
      color: #225FFE;
    }
  }
}
</style>
